<?php
/**
 * $Id$
 */
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function __construct()
	{
		parent::__construct();
	}

	/**
	 *
	 */
	public function index()
	{
		$this->check_sync_login();
		$this->load->view('home_header');
		$this->load->view('home_index');
		$this->load->view('cm_footer');
		$this->output->enable_profiler(TRUE);
	}

	/**
	 * 检查用户是否由其他应用登录
	 */
	private function check_sync_login()
	{
		$this->load->helper('encrypt');
		$auth = $this->input->cookie('hero_auth');
		$decode_auth = _authcode($auth, 'DECODE', $this->config->item('encryption_key'));
		if(!empty($decode_auth)) {
			list($uid, $username) = explode("\t", $decode_auth);
			$sess_data = array(
				'username' => $username,
				'uid' => $uid
			);
			$this->session->set_userdata($sess_data);
		}
		
	}
}

/* End of file index.php */
/* Location: ./application/controllers/welcome.php */

